package m.html.element;

import m.html.element.attr.ButtonType;
import m.html.element.attr.Size;
import m.html.element.other.IElement;

public class Button extends Element implements IElement {
	
	public Button() {
		this(Size.DEFAULT, ButtonType.DEFAULT);
	}
	public Button(ButtonType type) {
		this(Size.DEFAULT,type);
	}
	public Button(Size size) {
		this(size,ButtonType.DEFAULT);
	}
	private Size size;
	private ButtonType type;
	public Button(Size size,ButtonType type) {
		super("a-button");
		this.setSize(size);
		this.setType(type);
		
	}
	public Size getSize() {
		return size;
	}
	public Button setSize(Size size) {
		this.size = size;
		super.A("size", size.toString());
		return this;
	}
	public ButtonType getType() {
		return type;
	}
	public Button setType(ButtonType type) {
		this.type = type;
		super.A("type", this.type.getType());
		super.delAttr("ghost");
		if(this.getType().getParam().contains("ghost")) {
			super.A("ghost");
		}
		super.delAttr("danger");
		if(this.getType().getParam().contains("danger")) {
			super.A("danger");
		}
		return this;
	}

	//禁用
	public String getDisabled() {
		return this.getAttr(":disabled");
	}
	public Button setDisabled(String disabled) {
		this.A(":disabled",disabled);
		return this;
	}
}
